import request from "@/utils/request"

export function addAddress(address) {
    return request({
        method: "post",
        url: '/userAddress/addAddress',
        params: address
    })
}

export function getAddress(page, size, userId, keyWord) {
    return request({
        method: "get",
        url: '/userAddress/getAddress',
        params: {
            page: page,
            size: size,
            userId: userId,
            keyWord: keyWord
        }
    })
}

export function getAddressById(addrId, userId) {
    return request({
        method: "get",
        url: '/userAddress/getAddressById',
        params: {
            addrId: addrId,
            userId: userId
        }
    })
}

export function updateAddressById(address) {
    return request({
        method: "post",
        url: '/userAddress/updateAddressById',
        params: address
    })
}

export function deleteAddressById(addrId) {
    return request({
        method: "get",
        url: '/userAddress/deleteAddressById',
        params: {
            addrId: addrId
        }
    })
}

export default {
    addAddress, deleteAddressById, getAddress, getAddressById, updateAddressById
}